Skip to content

Adding discord rich presence support for Windows64 (Early)#968

Draft
acth2 wants to merge 2 commits intosmartcmd:mainfrom
acth2:feature/discord-rich-presence
Draft

Adding discord rich presence support for Windows64 (Early)#968
acth2 wants to merge 2 commits intosmartcmd:mainfrom
acth2:feature/discord-rich-presence

Conversation

@acth2
Copy link
Contributor

@acth2 acth2 commented Mar 8, 2026

Description

Reintroducing the Discord rich presence system, this idea come from #954

Changes

Previous Behavior

There were the functions for rich presence but no code inside of them: the code is still in an very early state but it works!
image

Root Cause

I needed to recode the discord rich presence but the system that tracks the players action and that permit me to modify what the rich presence says was already coded!

New Behavior

in Minecraft:Init i call ProfileManager.RichPresenceInit(...) and in Minecraft::tick i call player->updateRichPresence(); to constantly update the rich presence

Fix Implementation

Previously it looked like this:
void C_4JProfile::RichPresenceInit(int iPresenceCount, int iContextCount) {}
void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID, int iVal) {}
i just called discord-rpc.h and followed instructions to make a rich presence from there:
image

It works but its ugly for now!

AI Use Disclosure

nop

Related Issues

@acth2 acth2 marked this pull request as draft March 8, 2026 19:21
@eff3ry
Copy link

eff3ry commented Mar 9, 2026

would it be better to hook directly into the localised strings?
Minecraft.Client/Windows64Media/loc/stringsRichPresence.xml

@eff3ry
Copy link

eff3ry commented Mar 9, 2026

Obviously this wont be a drop in replacement but just an example, app is referenced in many files the same way, not sure which file app is defined though 🤷‍♂️

static std::string s_detailsUtf8;
static std::string s_stateUtf8;

s_detailsUtf8 = app.GetString(IDS_DISCORD_DETAILS_PLAYING_LCE);
discordPresence.details = s_detailsUtf8.c_str();

switch (iVal) {
  case CONTEXT_GAME_STATE_NETHER:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_NETHER);
    break;
  ...
  default:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_SURVIVING);
    break;
}
discordPresence.state = s_stateUtf8.c_str();
Discord_UpdatePresence(&discordPresence);

@acth2
Copy link
Contributor Author

acth2 commented Mar 9, 2026

would it be better to hook directly into the localised strings? Minecraft.Client/Windows64Media/loc/stringsRichPresence.xml

thx i'll do it now

@acth2 acth2 force-pushed the feature/discord-rich-presence branch 6 times, most recently from daf1ae1 to e42a1f8 Compare March 9, 2026 16:26
@acth2 acth2 force-pushed the feature/discord-rich-presence branch from e42a1f8 to 2d246ed Compare March 9, 2026 16:35
@acth2
Copy link
Contributor Author

acth2 commented Mar 9, 2026

Obviously this wont be a drop in replacement but just an example, app is referenced in many files the same way, not sure which file app is defined though 🤷‍♂️

static std::string s_detailsUtf8;
static std::string s_stateUtf8;

s_detailsUtf8 = app.GetString(IDS_DISCORD_DETAILS_PLAYING_LCE);
discordPresence.details = s_detailsUtf8.c_str();

switch (iVal) {
  case CONTEXT_GAME_STATE_NETHER:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_NETHER);
    break;
  ...
  default:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_SURVIVING);
    break;
}
discordPresence.state = s_stateUtf8.c_str();
Discord_UpdatePresence(&discordPresence);

It's done thx for the example btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants